import request from '@/utils/request'
import { SysDeptQuery, SysDeptParams } from '@/common/interface/dept.ts';

// 查询部门列表
export function listDept(query: SysDeptQuery) {
    return request({
        url: '/system/dept/list',
        method: 'get',
        params: query
    })
}

// 查询部门树形列表
export function listTreeDept(query: SysDeptQuery) {
    return request({
        url: '/system/dept/treeList',
        method: 'get',
        params: query
    })
}

// 查询部门下拉树选择列表
export function treeSelect() {
    return request({
        url: '/system/dept/treeSelect',
        method: 'get'
    })
}

// 查询部门详细
export function getDept(id: number) {
    return request({
        url: '/system/dept/' + id,
        method: 'get'
    })
}

// 新增部门
export function addDept(data: SysDeptParams) {
    return request({
        url: '/system/dept',
        method: 'post',
        data: data
    })
}

// 修改部门
export function updateDept(data: SysDeptParams) {
    return request({
        url: '/system/dept',
        method: 'put',
        data: data
    })
}

// 删除部门
export function delDept(id: number) {
    return request({
        url: '/system/dept/' + id,
        method: 'delete'
    })
}
